{template "header.html"}
<script type="text/javascript">
    $(function() {
        dr_type({intval($data.type)});
    });
    function dr_type(i) {
        $('.vv').hide();
        $('.v'+i).show();
    }
</script>
<form class="form-horizontal" method="post" role="form" id="myform">
    {$form}
    <div class="form-body">

        <div class="form-group">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('类型')}</label>
            <div class="col-xs-8">
                <div class="mt-radio-inline">
                    {loop $type $i $t}
                    <label class="mt-radio mt-radio-outline"><input onclick="dr_type({$i})" name="data[type]" type="radio" value="{$i}" {if $data.type==$i}checked=""{/if} /> {$t} <span></span></label>
                    {/loop}
                </div>
            </div>
        </div>
        <div class="form-group" id="dr_row_name">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('名称')}</label>
            <div class="col-xs-8">
                <input type="text" onblur="d_topinyin('cname', 'name');" class="form-control" id="dr_name" name="data[name]" value="{$data.name}">
            </div>
        </div>
        <div class="form-group" id="dr_row_cname">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('别名')}</label>
            <div class="col-xs-8">
                <input type="text" class="form-control" id="dr_cname" name="data[cname]" value="{$data.cname}">
            </div>
        </div>
        <div class="form-group vv v1 " style="display:none">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('变量值')}</label>
            <div class="col-xs-8">
                <textarea class="form-control" style="height:100px" name="data[value][1]">{$data.value}</textarea>

            </div>
        </div>
        <div class="form-group vv v0 " style="display:none">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('变量值')}</label>
            <div class="col-xs-8">
                <div class="mt-radio-inline">
                    <label class="mt-radio mt-radio-outline"><input name="data[value][0]" type="radio" value="1" {if $data.value}checked=""{/if} /> {dr_lang('是(真)')} <span></span></label>
                    <label class="mt-radio mt-radio-outline"><input name="data[value][0]" type="radio" value="0" {if !$data.value}checked=""{/if} /> {dr_lang('否(假)')} <span></span></label>

                </div>
            </div>
        </div>
        {if $code}

        <link href="{THEME_PATH}assets/global/plugins/codemirror/lib/codemirror.css" rel="stylesheet" type="text/css" />
        <link href="{THEME_PATH}assets/global/plugins/codemirror/theme/neat.css" rel="stylesheet" type="text/css" />
        <link href="{THEME_PATH}assets/global/plugins/codemirror/theme/ambiance.css" rel="stylesheet" type="text/css" />
        <link href="{THEME_PATH}assets/global/plugins/codemirror/theme/material.css" rel="stylesheet" type="text/css" />
        <link href="{THEME_PATH}assets/global/plugins/codemirror/theme/neo.css" rel="stylesheet" type="text/css" />

        <script src="{THEME_PATH}assets/global/plugins/codemirror/lib/codemirror.js" type="text/javascript"></script>
        <script src="{THEME_PATH}assets/global/plugins/codemirror/mode/javascript/javascript.js" type="text/javascript"></script>
        <script src="{THEME_PATH}assets/global/plugins/codemirror/mode/htmlmixed/htmlmixed.js" type="text/javascript"></script>
        <script src="{THEME_PATH}assets/global/plugins/codemirror/mode/css/css.js" type="text/javascript"></script>
        <script type="text/javascript">
            var ComponentsCodeEditors = function () {

                var handleDemo1 = function () {
                    var myTextArea = document.getElementById('code_editor_demo_1');
                    var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
                        lineNumbers: false,
                        matchBrackets: true,
                        styleActiveLine: true,
                        theme:"neo",
                        mode: 'css',
                        readOnly: true
                    });
                }

                return {
                    //main function to initiate the module
                    init: function () {
                        handleDemo1();
                    }
                };

            }();

            jQuery(document).ready(function() {
                ComponentsCodeEditors.init();
            });
        </script>
        <div class="form-group ">
            <label class="col-xs-3 control-label ajax_name">{dr_lang('调用说明')}</label>
            <div class="col-xs-8">
                 <textarea style="height:30px" id="code_editor_demo_1">{$code}</textarea>
            </div>
        </div>
        <style>
            .CodeMirror {
            {if $data.type}
                height: 80px;
                padding-left:10px;
            {else}
                height:120px;
                padding-left:10px;
            {/if}
            }
            </style>
        {/if}
    </div>
</form>

<link href="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/fuelux/js/spinner.min.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/global/plugins/bootstrap-touchspin/bootstrap.touchspin.js" type="text/javascript"></script>
<script type="text/javascript">
    $(function(){
        $("#displayorder").TouchSpin({
            buttondown_class: "btn red",
            buttonup_class: "btn green",
            min: 0,
            max: 255
        });
    });
</script>
{template "footer.html"}